package com.linln.modules.lzgd.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.linln.common.enums.StatusEnum;
import com.linln.common.utils.StatusUtil;
import com.linln.modules.system.domain.User;
import lombok.Data;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Where;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * @author 小懒虫
 * @date 2023/12/03
 */
@Data
@Entity
@Table(name="lzgd_base_infobase_info")
@EntityListeners(AuditingEntityListener.class)
@Where(clause = StatusUtil.NOT_DELETE)
public class BaseInfo implements Serializable {
    // 主键ID
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    private Long id;
    // 设区市
    private String sqs;
    // 县市区
    private String xsq;
    // 乡镇
    private String xiangzhen;
    // 村
    private String cun;
    // 问题来源
    private String wtly;
    // 监测编号
    private String jcbh;
    // 下发批次
    private String xfpc;
    // 面积
    private String mj;
    // 耕地面积
    private String gdmj;
    // 永久基本农田
    private String jbnt;
    // 问题类型
    private String wtlx;
    // 违法项目
    private String wfxm;
    // 违法主体
    private String wfzt;
    // 建设内容
    private String jsnr;
    // 建设时间
    private String jssj;
    // 违建年份
    private String wjnf;
    // 是否整改到位
    private String sfzgdw;
    // 整改措施
    private String zgcs;
    // 完成整改时间
    private String wczgsj;
    // 整改情况备注
    private String zgqkbz;
    // 是否处置到位
    private String sfczdw;
    // 处置措施
    private String czcs;
    // 处置时间
    private String czsj;
    // 拟采取的整改措施
    private String xybcs;
    // 拟完成时间
    private String yjwcsj;
    // 未完成整改备注
    private String wzgbz;
    // 是否纳入点题整治
    private String sfnrdtzz;
    // 是否纳入省级主题教育
    private String sfnrsjztjy;
    // 确认新增年份
    private String qrxzYear;
    // 确认新增月份
    private String qrxzMonth;
    // 备注
    private String remark;
    // 更新标记
    private String flag;
    // 创建时间
    @CreatedDate
    private Date createDate;
    // 更新时间
    @LastModifiedDate
    private Date updateDate;
    // 创建者
    @CreatedBy
    @ManyToOne(fetch=FetchType.LAZY)
    @NotFound(action=NotFoundAction.IGNORE)
    @JoinColumn(name="create_by")
    @JsonIgnore
    private User createBy;
    // 更新者
    @LastModifiedBy
    @ManyToOne(fetch=FetchType.LAZY)
    @NotFound(action=NotFoundAction.IGNORE)
    @JoinColumn(name="update_by")
    @JsonIgnore
    private User updateBy;
    // 数据状态
    private Byte status = StatusEnum.OK.getCode();

    @Override
    public boolean equals(Object o){
        if(this==o)return true;
        if(o==null||getClass()!=o.getClass())return false;
        BaseInfo baseInfo=(BaseInfo)o;
        if(sqs.equals(baseInfo.getSqs())&&xsq.equals(baseInfo.getXsq())&&xiangzhen.equals(baseInfo.getXiangzhen())&&cun.equals(baseInfo.getCun())&&
                wtly.equals(baseInfo.getWtly())&&jcbh.equals(baseInfo.getJcbh())&&
                xfpc.equals(baseInfo.getXfpc())&&mj.equals(baseInfo.getMj())&&
                gdmj.equals(baseInfo.getGdmj())&&jbnt.equals(baseInfo.getJbnt())&&
                wtlx.equals(baseInfo.getWtlx())&&wfxm.equals(baseInfo.getWfxm())&&
                wfzt.equals(baseInfo.getWfzt())&&jsnr.equals(baseInfo.getJsnr())&&
                jssj.equals(baseInfo.getJssj())&&wjnf.equals(baseInfo.getWjnf())&&
                sfzgdw.equals(baseInfo.getSfzgdw())&&zgcs.equals(baseInfo.getZgcs())&&
                wczgsj.equals(baseInfo.getWczgsj())&&zgqkbz.equals(baseInfo.getZgqkbz())&&
                sfczdw.equals(baseInfo.getSfczdw())&&czcs.equals(baseInfo.getCzcs())&&
                czsj.equals(baseInfo.getCzsj())&&xybcs.equals(baseInfo.getXybcs())&&
                yjwcsj.equals(baseInfo.getYjwcsj())&&wzgbz.equals(baseInfo.getWzgbz())&&
                sfnrdtzz.equals(baseInfo.getSfnrdtzz())&&sfnrsjztjy.equals(baseInfo.getSfnrsjztjy())&&
                qrxzYear.equals(baseInfo.getQrxzYear())&&qrxzMonth.equals(baseInfo.getQrxzMonth())){
              return true;
            }else
                return false;

        }
    }